﻿using System;
using System.Runtime.Serialization;
using System.Security.Principal;

using SBPweb.PROvibe.Shared.Library.Actors;
using SBPweb.PROvibe.Shared.Library.Base;

namespace SBPweb.PROvibe.Server.Modules.UserProvider
{

    [DataContract]
    public class User : IUser
    {

        #region Constructor logic

        public User()
        {
        }

        public User(IIdentity identity)
        {
            Name = identity.Name;
            Identity = identity;
        }

        #endregion

        #region Properties

        [DataMember]
        public string Name
        {
            get;
            set;
        }

        [IgnoreDataMember]
        protected IIdentity Identity
        {
            get;
            private set;
        }

        #endregion

        #region Methods

        public int CompareTo(INameable other)
        {
            if (other == null)
            {
                return 0;
            }
            return this.Name.CompareTo(other.Name);
        }

        public int CompareTo(object obj)
        {
            return CompareTo(obj as INameable);
        }

        #endregion

    }

}